﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;
using System.Net;
using System.Net.Sockets;
using Ling.P2P.Provider;
using Ling.P2P.DemoLib;

namespace Ling.P2P.PClient
{
    static class Program
    {
        public static TcpP2PClientEntry P2PClient;
        public static ClientInfoCollections LogInClients;
        public static IPEndPoint SvrEndPoint;
        public static string Me;

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            P2PClient = new TcpP2PClientEntry();
            P2PClient.UseAddressFamily = AddressFamily.InterNetwork;
            LogInClients = new ClientInfoCollections();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // 先弹出登入对话框。
            ClientLogInDlg LogInDlg = new ClientLogInDlg();
            LogInDlg.ShowDialog();
            bool logIn_ok = LogInDlg.IsLogIn;
            LogInDlg.Dispose();
            if (logIn_ok)
                Application.Run(new ClientMainWnd());

            P2PClient.StopListen = true; // 程序结束后停止侦听。
        }
    }
}
